using Unity.Mathematics;
using WorldMapBase.Tile.Pool;
using Yoozoo.Libs;

namespace WorldMapBase.Tile
{
    public class TileHideCmd : TileCommandBase,IClass
    {
        public int LayerID;
        public int LodIndex;
        public int TileIndex;
        public void Init(int layerID,int lodIndex,int tileIndex)
        {
            LayerID = layerID;
            LodIndex = lodIndex;
            TileIndex = tileIndex;
        }
        
        public override bool Check()
        {
            return TileDisplayManager.Instance.TileIsShowing(LayerID, LodIndex, TileIndex);
        }

        public override void Execute()
        {
            TileDisplayManager.Instance.OnRemoveTile(this);
            
#if UNITY_EDITOR
            TileDisplayManager.TileNum--;
#endif
        }

        public override void Recover()
        {
            ClassPoolManager.RecoverTileHideCmd(this);
        }

        public void OnReset()
        {
            LayerID = -1;
            LodIndex = -1;
            TileIndex = -1;
        }
    }
}